#ifndef WHALEABSTRACTCONNECT_H
#define WHALEABSTRACTCONNECT_H

#include <QVariant>
#include <QMap>
#include <QPair>
#include <QNetworkReply>
#include <QNetworkAccessManager>
#include <QString>

/*
 * This should be parent of all WhaleConnect classes.
 *
 * WhaleConnect classes are interfaces to API.
 * (One class for each supported API).
 * See WhaleTwitterConnect for example.
 *
 * Provides abstraction for watching a URL like a stream,
 * sending cookies and other.
 */
class WhaleAbstractConnect : public QObject {
    Q_OBJECT

    public:
        WhaleAbstractConnect( QObject * parent = 0 );
        QNetworkAccessManager * manager();
        QString currentStreamName();

    public slots:
        void callback();
        void watch( QUrl url, QObject * receiver, const char * method );
        void setCurrentStreamName( QString name );

    signals:
        void newData( QVariantList, QString streamName );
        void informCallback( QVariant result );

    private:
        QMap< QNetworkReply *, QPair< QObject *, const char * > > mCallbacks;
        QNetworkAccessManager * mConnector;
        QString mCurrentStreamName;
};

#endif
